package net.babypai;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;



public class LoginDialog extends Activity implements OnClickListener {
	private Button bnLogin,bnRegist,login_btn_cancel;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login_dialog);
		bnLogin = (Button) findViewById(R.id.bnLogin);
		bnRegist = (Button) findViewById(R.id.bnRegist);
		login_btn_cancel = (Button) findViewById(R.id.login_btn_cancel);
		bnLogin.setOnClickListener(this);
		bnRegist.setOnClickListener(this);
		login_btn_cancel.setOnClickListener(this);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event){
		LoginDialog.this.finish();
		return true;
	}
	
	public void exitbutton1(View v) {  
    	LoginDialog.this.finish();    	
      }  
	public void exitbutton0(View v) {  
    	LoginDialog.this.finish();
      }

	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.bnLogin:
			Intent intent = new Intent(LoginDialog.this,Loginiiya.class);
			startActivity(intent);
			LoginDialog.this.finish();
			break;
		case R.id.bnRegist:
			Intent intent2 = new Intent(LoginDialog.this,RegistBabyPai.class);
			startActivity(intent2);
			LoginDialog.this.finish();
			break;
		case R.id.login_btn_cancel:
			LoginDialog.this.finish();
			break;
		default:
			break;
		}
		
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			LoginDialog.this.finish();
		}
		return false;
	}
	
}
